# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=crazydiskinfo
pkgver=1.1.0
pkgrel=0
pkgdesc="interactive TUI S.M.A.R.T viewer"
url="https://github.com/otakuto/crazydiskinfo"
arch="all"
license="MIT"
options="!check" # no tests
makedepends="cmake ncurses-dev libatasmart-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/otakuto/crazydiskinfo/archive/$pkgver.tar.gz
	disable-linking-tinfow.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	make -C build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=1 make -C build check
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="57e9ea4f8abec18355806da35225132f06a5562b1717e6dca1515043b2a0f2a51b47a2bcda31f1e64d6b2e9c8c6de5445d835f59eed79fd0911e06fd32296803  crazydiskinfo-1.1.0.tar.gz
d1f1ee89be20302f76e360bf1b8aa9bac253a0e273b926225d8e65144f7c4443123a6304c93aeb102d7a93408ad3fecf1788cca06aee1b94f734dd4a3cd7170f  disable-linking-tinfow.patch"
